import Vue from 'vue'
import Vuex from 'vuex'
import getters from './getters'
import app from './modules/app'
import settings from './modules/settings'
import user from './modules/user'
import admin from './modules/admin'
import goodOrder from './modules/goodOrder'
import service from './modules/service'
import shopDoor from './modules/shopDoor'
import commoditys from './modules/commoditys'
import apply from './modules/apply'
import serviceOrder from './modules/serviceOrder'
import applying from './modules/applying'    // 申请中

Vue.use(Vuex)

const store = new Vuex.Store({
  modules: {
    app,
    settings,
    apply,
    admin,
    shopDoor,
    user,
    goodOrder,
    service,
    serviceOrder,
    applying,
    commoditys

  },
  getters,
  // 权限配置
  state: {
    adminInfo: {}, // 存储用户的信息
    isAddRouter: false, // 是否动态的添加过路由
    asyncRoutes: [] // 动态的路由表
  },
  mutations: {
    // 公共方法
    update(state, obj) {
      let { name, value } = obj;
      state[name] = value;
    }
  }
})

export default store
